
{extend name="layout"}
{block name="title"}首页{/block}
{block name="body"}
<div class="home-content">

	<div class="home-head">
		<img src="__ROOT__/static/personal/images/avatar.png">
		<div class="head-box">
			<p>{$member.loginname|default=''}</p>
			{if $member.mobile eq true}
			<span>手机号：{$member.mobile|default=''}</span>
			{/if}
		</div>
		
		<div class="head-phone" onclick="bindPhone()">
			<span class="iconfont icon-shouji"></span>
			{if $member.mobile eq true}
			<p>修改手机号</p>
			{else/}
			<p>绑定手机号</p>
			{/if}
		</div>

	</div>
	
	
	
	{if ($increase eq false) || ($increase.status eq 3) || ($increase.status eq 1 && $increase.examine eq 1)}
	<!--一、无信息-->
	<div class="info-box home-blank">
		<img src="__ROOT__/static/personal/images/index-blank.png">
		<span>暂无信息~</span>
	</div>
	{else/}	
	<!--二、有信息-->
	<div class="info-box info-user">
		<p class="title">员工信息
			{if $page_type eq 1 }
			<span class="is-quit" style="color: #ff5656;">（离职）</span>
			{/if}
		</p>
		<p><span> 姓名</span> 		<span> {$increase.name|default=''}</span></p>
		<p><span> 身份账号</span> 	<span> {$increase.id_number|default=''}</span></p>
		<p><span> 手机号</span> 		<span> {$increase.mobile|default=''}</span></p>
		<p><span> 所属公司</span> 	<span> {$company.name|default=''}</span></p>

	</div>
	{if $archives eq true}
		{if $archives.status eq 1}
			<div class="info-box info-detail">
				<div class="detail-title">
					<span>档案详情</span>
					<span>显示档案在本公司的托管情况</span>
				</div>
		
				<div class="info-before">
					<img src="__ROOT__/static/personal/images/index-blank.png">
					<span>业务正在办理中，暂无档案数据 ~</span>
				</div>
		
			</div>
		{elseif $archives.status eq 2}
			{if $archives.person_status eq 1}
			<div class="info-box info-detail">
				<div class="detail-title">
					<span>档案详情</span>
					<span>显示档案在本公司的托管情况</span>
				</div>
				<div class="info-after">
					<div>
						<div><span>档案情况</span><span class="is-blue">已转入</span></div>
						<div>
							<span>转入时间</span><span class="is-blue">{$archives.into_date|default=''}</span>
						</div>
					</div>
				</div>
			</div>			
			{else/}
			<div class="info-box info-detail">
				<div class="detail-title">
					<span>档案详情</span>
					<span class="is-red">请尽快联系转出您的档案，以免产生相关费用</span>
				</div>
				<div class="info-after">
					<div>
						<div><span>档案情况</span><span class="is-blue">待转出</span></div>
						<div>
							<span>转入时间</span><span class="is-blue">{$archives.into_date|default=''}</span>
						</div>
					</div>
				</div>
			</div>			
			{/if}
		{elseif $archives.status eq 3}
			<div class="info-box info-detail">
				<div class="detail-title">
					<span>档案详情</span>
					<span>显示档案在本公司的托管情况</span>
				</div>
				<div class="info-after">
					<div>
						<div><span>档案情况</span><span class="is-red">已转出</span></div>
						<div><span>转入时间</span><span class="is-blue">{$archives.into_date|default=''}</span></div>
						<div><span>转出时间</span><span class="is-blue">{$archives.out_date|default=''}</span></div>
					</div>
				</div>
			</div>				
		{/if}
	{/if}	
	
	
	{if $increase.status eq 2}
	<!-- 2.增员后	-->
		{if $page_type eq 2}
		<!--办理前-->
		<div class="info-box info-detail">
			<div class="detail-title">
				<span>参保详情</span>
				<span>仅做参考，具体参保情况以社保局信息为准</span>
			</div>
	
			<div class="info-before">
				<img src="__ROOT__/static/personal/images/index-blank.png">
				<span>业务正在办理中，暂无参保数据 ~</span>
			</div>
	
		</div>
		{elseif $page_type eq 3}
		<!--审核后-->
		<div class="info-box info-detail">
			<div class="detail-title">
				<span>参保详情</span>
				<span>仅做参考，具体参保情况以社保局信息为准</span>
			</div>
			<div class="info-after">
				{notempty name='insurances'}
				{foreach $insurances as $key=>$vo}
				<div>
					<span>{$vo.insurance|default=''}</span>
					<div><span>参保状态</span>{if $vo.status eq 1}<span class="is-blue">{else/}<span class="is-red">{/if}{$vo.status_cn|default=''}</span></div>
					<div>
						{if $vo.status eq 1}
						<span>起始时间</span><span class="is-blue">{$vo.start_date|default=''}</span>
						{else/}
						<span>截止时间</span><span class="is-red">{$vo.end_date|default=''}</span>
						{/if}
					</div>
				</div>
				{/foreach}
				{/notempty}
			</div>
		</div>
		{elseif $page_type eq 1}
		<!--离职后-->
		<div class="info-box info-detail">
			<div class="detail-title">
				<span>参保详情</span>
				<span>仅做参考，具体参保情况以社保局信息为准</span>
			</div>
			<div class="info-after">
				{notempty name='insurances'}
				{foreach $insurances as $key=>$vo}
				<div>
					<span>{$vo.insurance|default=''}</span>					
					<div><span>起始时间</span><span class="is-blue">{$vo.start_date|default=''}</span></div>
					<div><span>截止时间</span><span class="is-blue">{$vo.end_date|default=''}</span></div>
					<div><span>参保状态</span>{if $vo.status eq 1}<span class="is-blue">{else/}<span class="is-red">{/if}{$vo.status_cn|default=''}</span></div>
				</div>
				{/foreach}
				{/notempty}
			</div>
		</div>
		<div class="info-quit">
			<div class="info-box info-detail" >
				<div class="detail-title">
					<span>养老保险中断</span>
					<span>影响养老退休金，不能补缴</span>
				</div>
				<div class="detail-title">
					<span>医疗保险中断</span>
					<span>门诊住院无报销，补缴费多</span>
				</div>
				<div class="detail-title quit-method">
					<span>解决办法</span>
					<span>“社优保”是一款为离职人员解决工作空白期社保缺失的平台，识别下方二维码了解更多详情：</span>
				</div>
	
				<div class="quit-wechat">
					<img src="__ROOT__/static/personal/images/wechat2.png">
	
				</div>
	
			</div>
		</div>		
		{/if}	
	{else/}
	<!-- 1.增员前	-->
	<div class="info-box info-more">
		<p class="title">完善参保信息
		</p>
		{if ($increase.id_front eq true) || ($increase.id_back eq true)}
		<!--身份证已上传-->
		<div class="info-img">
			<div>
				<span>身份证图片</span>
				<span onclick="window.location.href='idupload.html?id={$increase.id}';">编辑   <span style="font-size: 0.213rem" class="iconfont icon-a-lujing2245"></span></span>
			</div>

			<div>
				<img src="{$increase.id_front|default=''}"  style=" width: 3.653rem;border: 1px solid #e6e6e6;" />
				<img src="{$increase.id_back|default=''}"  style=" width: 3.653rem;border: 1px solid #e6e6e6;" />

			</div>

		</div>
		{else/}
		<!--身份证未上传-->
		<div class="info-not-img">
			<span>身份证图片</span>
			<button onclick="window.location.href='idupload.html?id={$increase.id}';">上传图片</button>
		</div>
		{/if}
		{if ($increase_insurances eq true) && ($is_show eq 1) }
		<!--保险状态已添加-->
		<div class="info-insurances">
			<div>
				<div>
					<span>保险状态</span>
					<span>请填写您当前保险的状态</span>
				</div>
				<span onclick="window.location.href='handtype.html?id={$increase.id}';">编辑 <span style="font-size: 0.213rem" class="iconfont icon-a-lujing2245"></span></span>

			</div>
			{notempty name='increase_insurances'}
			{foreach $increase_insurances as $key=>$vo}
			<p><span>{$vo.insurance|default=''}</span> <span>{$vo.hand_type|default=''}</span></p>
			{/foreach}
			{/notempty}
		</div>		
		{else/}
		<!--保险状态未添加-->
		<div class="info-not-insurances">
			<span>保险状态 <span>*请填写您当前保险的状态</span></span>
			<button onclick="window.location.href='handtype.html?id={$increase.id}';">点击填写</button>
		</div>
		{/if}
		
	</div>
	{/if}
	{/if}

<!--	<a class="logout" href='{:url("personal/login/logout")}'>退出登录</a>-->

	<div class="bind-phone" style="display: none">
		<img src="__ROOT__/static/personal/images/icon-phone.png">
		{if $member.mobile eq true}
		<p>修改手机号</p>
		{else/}
		<p>绑定手机号</p>
		{/if}
		<div class="form-phone" >
			<div class="input-box">
				<span>手机号</span>
				<input  autocomplete="off"  required pattern="^[\S]{4,}$" id="mobile" name="mobile"  autocomplete="off" placeholder="请输入手机号" style="border-radius: 0">

			</div>
			<div class="input-box">
				<span>验证码</span>
				<input autocomplete="off"  required pattern="^[\d]{4,}$" name="verify" maxlength="32" type="text" autocomplete="off" placeholder="请输入验证码">
				<div class="phone-code">
					<span>获取验证码</span>
				</div>

			</div>
		</div>
		<button onclick="submitBindCode()">确定</button>
	</div>
</div>

<div class="home-tab">
	<a href="{:url('personal/index/index')}">
		<span class="iconfont1 icon-shouye2 on"></span>
		<span>首页</span>
	</a>

	<a href="{:url('personal/user/index')}">
		<span class="iconfont icon-shenfenzheng"></span>
		<span>我的</span>
	</a>
</div>

{/block}
{block name="script"}
<script>
	$(document).ready(function(){
		//获取验证码
		timer="";
		nums = 60;
		phoneFlag = true;
		$(".phone-code").on("click","span",function(){
			var that = this
			if(phoneFlag){
				//检测手机号码
				var isCheck = checkPhone("mobile")
				if(!isCheck){
					return false
				}

				phoneFlag=false;



				// 发送验证码
				//个人 ：type 2;
				// verify_type:2(登录)    4（绑定手机号）
				$.ajax({
					url: '{:url("personal/login/send_sms")}',
					data: {
						"mobile":$("input[name='mobile']").val(),
						"type":2,
						"verify_type":4
					},
					type: "post",
					success: function(res) {
						if(res.code == 1) {
							layer.msg(res.info)
							// $.msg.alert("验证码发送成功，请等待~")

							// 验证码倒计时
							var code=$(that);
							timer=setInterval(function(){
								if(nums>0){
									nums--;
									code.html(nums+" 秒");
									code.addClass("gray-bg");
								}
								else{
									clearInterval(timer);
									nums=60;//重置回去
									phoneFlag = true
									code.html("获取验证码");
								}
							},1000)

						} else {
							phoneFlag = true
							layer.msg(res.info)
						}
					},
					error: function() {
						layer.msg("发送失败");
					}
				});


			}

		});
	})
	var bindPhone = function(){

		var index = layer.open({
			type: 1,
			title: false,//数组第二项可以写任意css样式；如果你不想显示标题栏，你可以title: false
			area: '7.733rem',
			content: $('.bind-phone')
		});

	}
	var submitBindCode = function (){
		var verify = $("input[name='verify']").val()
		var mobile = $("input[name='mobile']").val()

		if(!mobile){
			layer.msg("请填写手机号");
			return
		}
		if(!verify){
			layer.msg("请填写验证码");
			return
		}


		$.ajax({
			url: '{:url("changemb")}',
			data: {
				"mobile":mobile,
				"verify":verify,
				"type":2,
				"verify_type":4
			},
			type: "post",
			success: function(res) {
				if(res.code==1){
					layer.msg(res.info);
					setTimeout(function (){
						layer.closeAll()
						window.location.replace("index.html")
					},500)
				}else{
					layer.msg(res.info);
				}


			},
			error: function() {
				layer.msg("绑定失败");
			}
		});
	}
	var addId = function (){
		window.location.href="idupload.html";
	}



</script>
{/block}
{block name="style"}
<style>
	body .layui-layer{
		border-radius: 0.267rem;
	}
</style>
{/block}
